/**********************************************************************************************
Step 0: Basic setup
**********************************************************************************************/
** settings

clear all

** Bring in the data

use "$DATA_OUT/NMDB_ASMB_respondents"

* Just keep CD defaulters in the default sample
keep if x27==1
keep if in_default_sample==1

** Prep data and create useful variables
svyset [pweight = analysis_weight]

gen income_shock = (x91a==1) | (x92a==3)



/**********************************************************************************************
Get some additional results on CD defaulters for the appendix
**********************************************************************************************/

********************************************************************************
* Look at endogenous income increases
********************************************************************************

gen endogenous_income_increase = (x32e==1) | (x32f==1) | (x32g==1) | (x32h==1) | (x32h1_1==1) | (x32h2_1==1) 

svy: tab endogenous_income_increase if income_shock==0
svy: tab endogenous_income_increase if x92a==1 //those reporting an income *increase*



********************************************************************************
* Look at how many CD defaulters did something to address their difficulties
********************************************************************************

gen did_something = 0
foreach ll in a b c d e f g h h1_1 h2_1 i j m {
	replace did_something = 1 if x32`ll'==1
}

svy: tab did_something if EUW_or_disaster==0
svy: tab did_something if EUW_or_disaster==1


